package com.assignwork.service.impl;

import com.assignwork.dto.JobConfigDTO;
import com.assignwork.entity.JobConfig;
import com.assignwork.mapper.JobConfigMapper;
import com.assignwork.service.IJobConfigService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 作业配置实现类
 */
@Service
public class JobConfigServiceImpl extends BaseServiceImpl<JobConfigMapper, JobConfig> implements IJobConfigService {

    @Override
    public boolean saveOrUpdateDtoList(List<JobConfigDTO> dtos) {
        List<JobConfig> collect = dtos.stream().map(JobConfigDTO::toEtt).collect(Collectors.toList());
        return this.saveOrUpdateBatch(collect);
    }
}